<template>
  <el-row>
    <el-col  class="mx-auto"> 
        <li v-for="news in newsadd" :key="news.newsTitle" class="mx-auto">           
         <router-link :to="{ path: '/detail/'}">
          {{ news.newsTitle }}  
         </router-link> 
        </li>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: "NewsAdd",
  props:{
    categoryId:String
  },
  components: {
  
  },
  data() {
    return {
      newsadd: [],
    };
  },
  mounted() {
    this.getNewsadd();
  },
   watch:{
    newsName(){
      console.log(this.newsName)
      this.getNewsadd();
    },
    categoryId(){
       this.getNewsadd();
    }
  },
  methods: {
    getNewsadd() {
     this.$axios.get('/api/home/page/list?categoryId=' + this.categoryId)
     .then(response=>{this.newsadd = response.data.data})
    },
  },
};
</script>

<style>

</style>